import java.util.Scanner;

public class HihoCoder1481 {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int num = in.nextInt();
		while (num > 0) {
			num--;
			String value = in.next();
			checkOut(value);
		}
	}

	private static void checkOut(String value) {
		int L = 0, A = 0, O = 0;
		boolean isLast = false;
		char[] item = value.toCharArray();
		for (int i = 0; i < item.length; i++) {
			if (item[i] == 'A') {
				A++;
				if(A>1){
					break;
				}
			}
			if (item[i] == 'L') {
				if (i >= 2) {
					if (item[i - 1] == 'L' && item[i - 2] == 'L') {
						isLast = true;
						break;
					}
				}
			}
		}
		
		if(A<=1 && isLast==false){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}

	}

}
